USE [Tibet]
GO
/****** Object:  StoredProcedure [dbo].[SELMetricaDePerfil]    Script Date: 05/27/2011 05:32:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
CREATE PROCEDURE [dbo].[SELMetricaDePerfil]
	-- Add the parameters for the stored procedure here
	@IdProyecto int = 0
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	
	
	SELECT 
		M.idMetrica, M.NombreMetrica, M.Descripcion
	FROM 
		Tibet.dbo.Perfil_Metrica P, 
		Tibet.dbo.Metrica M, 
		Tibet.dbo.Perfil_Metrica_Metrica P_M, 
		Tibet.dbo.Proyecto Pr
	WHERE 
		Pr.idProyecto = @IdProyecto AND 
		Pr.Fk_Perfil_Metrica_idPerfil_Metrica = P.idPerfilMetrica AND 
		P.idPerfilMetrica = P_M.Fk_Perfil_Metrica_idPerfil_Metrica AND 
		P_M.Fk_Metrica_idMetrica = M.idMetrica;
	
	
END

